package com.yima.baseproj.module.sys.teacher;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yima.baseproj.config.mybatis.handler.MybatisDateTypeHandler;
import com.yima.baseproj.module.config.BaseEntity;
import com.yima.baseproj.module.sys.teacher.model.TeacherSearchAddModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
@TableName("yry_teacher")
public class TeacherEntity implements Serializable {

    @TableId(value = "id" ,type = IdType.AUTO)
    private Integer id;
    @ApiModelProperty(value = "教师姓名")
    private String teacherName;
    @ApiModelProperty(value = "教师性别(1男 2女)")
    private String teacherSex;
    @ApiModelProperty(value = "教师手机号")
    private String teacherPhone;
    @ApiModelProperty(value = "微信ID")
    private String teacherVxid;
    @ApiModelProperty(value = "微信名")
    private String teacherVxname;
    @ApiModelProperty(value = "微信头像")
    private String teacherVxavatar;
    @ApiModelProperty(value = "教师职位")
    private String teacherPosition;
    @ApiModelProperty(value = "教师编码")
    private String teacherCode;

    @TableField(exist = false)
    private Integer classId;

    @TableField(fill = FieldFill.INSERT,value = "create_by")
    private String createBy;

    @TableField(fill = FieldFill.INSERT,value = "create_time",typeHandler = MybatisDateTypeHandler.class)
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss",locale = "zh")
    private Date createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE,value = "update_by")
    private String updateBy;

    @TableField(fill = FieldFill.INSERT_UPDATE,value = "update_time",typeHandler = MybatisDateTypeHandler.class)
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss",locale = "zh")
    private Date updateTime;

    @TableField(value = "del_flag")
    @TableLogic(value = "0",delval = "1")
    private String delFlag = "0";

    public TeacherEntity(String teacherName, String teacherSex, String teacherPhone, String teacherPosition) {
        this.teacherName = teacherName;
        this.teacherSex = teacherSex;
        this.teacherPhone = teacherPhone;
        this.teacherPosition = teacherPosition;
    }

    public TeacherEntity(Integer id, String teacherName, String teacherSex, String teacherPhone, String teacherPosition) {
        this.id = id;
        this.teacherName = teacherName;
        this.teacherSex = teacherSex;
        this.teacherPhone = teacherPhone;
        this.teacherPosition = teacherPosition;
    }

    public TeacherEntity() {
    }

    public void setTeacherEntity(TeacherSearchAddModel paramModel){
        this.teacherName = paramModel.getTeacherName();
        this.teacherSex = paramModel.getTeacherSex();
        this.teacherPhone = paramModel.getTeacherPhone();
        this.teacherPosition = paramModel.getTeacherPosition();
    }
}
